﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace MartinRL.ProjectEuler
{
    /// <summary>
    /// http://projecteuler.net/index.php?section=problems&id=21
    /// </summary>
    public static class Problem021
    {
        public static int FindTheSumOfAllTheAmicableNumbersUnder10000()
        {
            return 0.To(10000 - 1)
                .Where(t => t == t.SumOfProperDivisors().SumOfProperDivisors()
                         && t != t.SumOfProperDivisors())
                .Sum();
        }
    }
}